<?php
require_once 'lib/config.php';
require_once 'lib/functions.php';

$id = isset($_GET['id'])?$_GET['id']:'';
if ($_POST) {
    $id = isset($_POST['id'])?$_POST['id']:0;
    $reply = isset($_POST['reply'])?htmlentities($_POST['reply'],ENT_QUOTES):'';
    if ($reply=='') {
		msg('留言内容不能为空');
    } else {
        if ($db->query("UPDATE `guestbook` SET `reply` = '{$reply}' WHERE `id` = '$id';")) {
			msg('留言成功','index.php');
        } else {
			msg('系统错误');
        }
    }
}

require_once 'template/'.TPL.'/'.basename(__FILE__);
